package com.yu.waterstation.app.moudles.student.service;

import com.yu.waterstation.common.entity.app.Address;
import com.yu.waterstation.common.entity.app.dto.StudentDTO;
import com.yu.waterstation.common.entity.app.form.*;
import com.yu.waterstation.common.common.exception.ServiceException;
import com.yu.waterstation.common.common.util.result.Result;
import jodd.util.HtmlDecoder;
import org.apache.commons.lang3.StringUtils;
import org.springframework.web.HttpRequestHandler;

import javax.servlet.http.HttpServletRequest;

public interface StudentService {



    // 通过微信小程序获取的code在服务器获取微信openid登录
    Result<StudentDTO> loginByWx(WeixinLoginForm weixinLoginForm);


    /**
     * 获取学生详情信息
     * @param studentId
     * @return
     */
    StudentDTO getStudentInfo(Integer studentId) ;

    /**
     * 绑定微信
     */
    String bindWeiXin(Integer studentId, WeixinLoginForm form) throws ServiceException;

    /**
     * 修改密码
     * @param studentId
     * @param updatePasswordForm
     * @return
     * @throws Exception
     */
    int updatePassword(Integer studentId, UpdatePasswordForm updatePasswordForm) throws Exception;

    /**
     * 微信授权修改密码
     * @param studentId
     * @param vo
     * @return
     * @throws Exception
     */
    int updatePasswordByWeiXin(Integer studentId, UpdatePasswordByWeiXinForm vo) throws Exception;

    /**
     * 更新信息
     *
     * @param studentId
     * @param vo
     * @return StudentDTO
     * @throws Exception  地址不存在
     */
    int updateStudent(Integer studentId, UpdateStudentForm vo) throws Exception;

    // 设置寝室
    Address setAddress(Integer studentId, Integer addressId)throws Exception;

    // 通过学号和密码登录
    Result loginByStudentNoAndPassword(StudentLoginForm loginForm, String ip);
}
